import subprocess

MCHK = 'sudo /usr/local/cfw/scripts/admin_interface/get_tag.py'
NOTE = '/usr/local/cfw/scripts/reservation_system/send_notification.sh'

def chk_image(host):
	cmd = MCHK + " " + host
	p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
	return p.communicate()


def send_email(subject="AUTO-VERIFIER: Info", content="Message not provided", address=None):
	if not address:
		print "Email notification attempted with no address given"
		return (None,None)
	else:
		cmd = NOTE + " '" + address + "' '" + subject + "' '" + content + "'"
		p = subprocess.Popen(cmd, stderr=subprocess.PIPE, shell=True)
		return p.communicate()
